<template>
  <div class="home">
    <!-- <img alt="Vue logo" src="../assets/img/logo.png">
    <HelloWorld msg="Welcome to Your Vue.js App"/> -->
    <button @click="handleClick('back')">返回上一页</button>

    <!-- 通过js方法跳转到指定页面 -->
    <button @click="handleClick('push')">跳转</button>
    <button @click="handleClick('replace')">替换</button>
    {{food}}
  </div>
</template>

<script>
// @ is an alias to /src
// import HelloWorld from '@/components/HelloWorld.vue'

export default {
  name: 'Home',
  components: {
    // HelloWorld
  },
  methods: {
    handleClick(type){
      //this.$router.go(-1)  //后退一页
      //或者 this.$router.back()

      if(type === 'back'){
          this.$router.back()
      }else if(type === 'push'){
          const name = "llr"
          this.$router.push({
            path: `/argu/${name}`
          })
      }else if(type === 'replace'){
          this.$router.replace({
            name: 'parent',
            query:{
              name: 'listen123'
            }
          })
      }
    }
  },
  props: {
    food:{
      type: String,
      default:'apple'
    }
  }
}
</script>
